package leetcode.method.pointer;

import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;

/**
 * 此方法大数据量超时
 */
public class Program9IntegerPalindrome {
    public boolean isPalindrome(int x) {
        if (x < 0) {
            return false;
        }
        if (x <10) {
            return true;
        }
        int y = 0, tmp = x;
        while (x > 0) {
            y = y * 10 + x % 10;
            x = x / 10;
        }

        return tmp == y;
    }

    public static void main(String[] args) {
        Program9IntegerPalindrome myStack = new Program9IntegerPalindrome();
        int k1 = 3;
        System.out.println(myStack.isPalindrome(k1)); // 返回
        int k2 = 121;
        System.out.println(myStack.isPalindrome(k2)); // 返回
        int k3 = -121;
        System.out.println(myStack.isPalindrome(k3)); // 返回
        int k4 = 10;
        System.out.println(myStack.isPalindrome(k4)); // 返回
    }
}
